package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.dto.SearchInfo;
import com.example.demo.entity.Doctor;



@Repository()
public interface Doctor_Mapper extends BaseMapper<Doctor>{
	
	@Select("select doctor.*,department.name department_name "
			+ " from doctor inner join department on doctor.department_id=department.id ${where} ${limitstr}")
	public List<Doctor> select(SearchInfo info);
	@Select("select count(1) from doctor inner join department on doctor.department_id=department.id   ${where} ")
	public long selectCount(SearchInfo info);
	
	@Insert("insert into doctor (name,pass,sex,department_id,title) values(#{name},#{pass},#{sex},#{department_id},#{title})")
	public void insert (Doctor u);
	
	@Update("update doctor set name=#{name},sex=#{sex},department_id=#{department_id},title=#{title} where id=#{id}")
	public void update (Doctor u);
	
	
	@Select("delete from doctor where id=#{id}")
	public void delete(int id);
	
	@Select("select * from doctor where id=#{id} ")
	public Doctor selectById(int id);
	
	@Select("select * from doctor where name=#{name} ")
	public Doctor login(Doctor u);
	
}
